package com.youhui.weixin.config;

import com.youhui.weixin.domain.Admin;
import com.youhui.weixin.domain.Goods;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
import org.springframework.data.rest.webmvc.ProfileResourceProcessor;
import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration;

/**
 * Created by https://github.com/kuangcp on 17-9-26  下午3:26
 * RESTFUL 风格的配置
 */
@Configuration
public class RestfulConfiguration extends RepositoryRestMvcConfiguration {
    @Override
    public RepositoryRestConfiguration config() {
        return super.config();
    }
    // 还可以重写别的Config开头的方法进行自定义配置

    @Override
    public ProfileResourceProcessor profileResourceProcessor(RepositoryRestConfiguration config) {
        // 设置rest根目录是应用路径下的路径
        config.setBasePath("/rest");
        // 允许暴露id出来，默认不输出id
        config.exposeIdsFor(Goods.class);
        config.exposeIdsFor(Admin.class);
        return super.profileResourceProcessor(config);

    }
}
